const fs = require('fs')

module.exports = (app) => {
    fs.readdirSync(__dirname).forEach(file => {   //同步读取目录
        if(file === 'index.js'){ return;}
        const route = require(`./${file}`);
        app.use(route.routes()).use(route.allowedMethods()); //options allowedMethods
    })
}